<?php
    // estilos -- ver por qué no puedo usar class con un css - otra clase debe estar bloqueandolo
    $tabla_orga_td = 'vertical-align: middle; border: none;';    

    // imagenes
    $prev_img = $this->Html->image("restaurante/ic_navegar_left.png", array("width" => "32px", "height" => "32px", "id" => "nav_icon_left"));    
    $next_img = $this->Html->image("restaurante/ic_navegar.png", array("width" => "32px", "height" => "32px", "id" => "nav_icon_right"));    
    $prev_img_disabled = $this->Html->image("restaurante/ic_nav_left_disabled.png", array("width" => "32px", "height" => "32px", "id" => "nav_icon_left_disabled"));    
    $next_img_disabled = $this->Html->image("restaurante/ic_navegar_disabled.png", array("width" => "32px", "height" => "32px", "id" => "nav_icon_right_disabled"));    


    $volver_img = $this->Html->image("restaurante/ic_close.png", array("id" => "back_icon"));    
    $nuevo_img = $this->Html->image("restaurante/ic_add.png", array("id" => "add_icon"));    
    $cancel_img = $this->Html->image("restaurante/ic_cancel.png", array("id" => "back_icon"));    
    $save_img = $this->Html->image("restaurante/ic_ok.png", array("id" => "save_icon"));    
    
    $editar_img = $this->Html->image("restaurante/doc_images.png", array("width" => "24px", "height" => "24px"));    
    
?>

<!--- MARCO DE LA PANTALLA ------>
<table><tr><td style="width: 20%; border: none;"></td>
        <td style="padding: 20px; background: white;<?php echo $tabla_orga_td;?>">

<table>
    <tr>
        <td style="width: 15%; text-align:right; <?php echo $tabla_orga_td;?>"><div><?php echo $this->Html->image("restaurante/ic_resto.png", array("id" => "resto_icon"));?></div></td>
        <td style="width: 55%; text-align:left; <?php echo $tabla_orga_td;?>"><h1 class="titulo_ventana_2">Editar producto</h1></td>
        <td style="width: 30%; text-align:right; <?php echo $tabla_orga_td;?>">
            <table>
                <tr><td style="text-align:right; <?php echo $tabla_orga_td;?>"><?php echo 'Usuario: '.$nombre_usuario;?></td></tr>
                <tr><td style="text-align:right; <?php echo $tabla_orga_td;?>"><?php echo $this->Html->link('Cerrar sesión', array("controller"=>"users", "action"=>"logout"), array('title' => 'Cerrar sesión', 'escape' => false));?></td></tr>
            </table>
        </td>
    </tr>      
</table>
<hr>

<?php $options = array(1 => 'Cocina', 2 => 'Cafetería'); ?>    
<?php echo $this->Form->create('Producto'); ?>

<!--- CONTROLES ------>
<table>
    <tr>
        <td style="width: 50%;<?php echo $tabla_orga_td;?>" colspan="2"><?php echo $this->Form->input('rubro_id', array('empty' => '(elija uno)', 'label' => 'Código Rubro')); ?></td>
        <td style="width: 50%;<?php echo $tabla_orga_td;?>" colspan="3"><?php echo $this->Form->input('subrubro_id', array('empty' => '(elija uno)', 'label' => 'Código Subrubro')); ?></td>
    </tr>
    <tr>
        <td style="width: 20%; text-align:right;" class="categoria_label_required">
            <?php echo $this->Form->label('categoria', 'Categoría<span style="color: red; ">*</span>', array('class' => 'required')); ?></td>
        <td style="width: 30%; vertical-align: middle; <?php echo $tabla_orga_td;?>"><?php echo $this->Form->radio('categoria', $options, array('legend'=> false)); ?></td>
        <td style="width: 15%;<?php echo $tabla_orga_td;?>"><?php echo $this->Form->input('activo', array('label' => 'Activo')); ?></td>
        <td style="width: 15%; text-align:right; vertical-align: middle; <?php echo $tabla_orga_td;?>">
            <?php echo $this->Form->label('admite', 'Admite<span style="color: black; "></span>'); ?></td>        
        <td style="width: 20%;<?php echo $tabla_orga_td;?>">
            <table>
                <tr><td style="<?php echo $tabla_orga_td;?>"><?php echo $this->Form->input('admite_guarniciones', array('label' => 'Guarniciones')); ?></td></tr>
                <tr><td style="<?php echo $tabla_orga_td;?>"><?php echo $this->Form->input('admite_salsas', array('label' => 'Salsas')); ?></td></tr>
            </table>            
        </td>
    </tr>
</table>
<table>
    <tr>
        <td style="width: 25%;<?php echo $tabla_orga_td;?>"><?php echo $this->Form->input('codigo', array('label' => 'Código')); ?></td>
        <td style="width: 25%;<?php echo $tabla_orga_td;?>"><?php echo $this->Form->input('precio', array( 'type' => 'number', 'label' => 'Precio($)')); ?></td>
        <td style="width: 25%;<?php echo $tabla_orga_td;?>"><?php echo $this->Form->input('stock', array( 'label' => 'Hay Stock')); ?></td>
        <td style="width: 25%;<?php echo $tabla_orga_td;?>"></td>
    </tr>
    <tr>
        <td style="width: 100%;<?php echo $tabla_orga_td;?>;" colspan="4"><?php echo $this->Form->input('descripcion', array('label' => 'Descripción')); ?></td>
    </tr>
</table>

<!--- BOTONERA ------>
<table>
    <tr>
        <td style="width: 10%; text-align:right; <?php echo $tabla_orga_td;?>"><?php echo 'Cancelar'; ?></td>
        <td style="width: 10%; text-align:left; <?php echo $tabla_orga_td;?>">
            <?php 
            switch($funcion_previa) {
                case 'Menus':
                    echo $this->Html->link($cancel_img, array("controller"=>"menus", "action"=>"index"), array('class' => 'button', 'title' => 'Cancelar', 'escape' => false));                    
                    break;
                default:
                    echo $this->Html->link($cancel_img, array("controller"=>"productos", "action"=>"index"), array('class' => 'button', 'title' => 'Cancelar', 'escape' => false));
                    break;
            } ?>
        </td>
        <td style="width: 60%; <?php echo $tabla_orga_td;?>"></td>
        <td style="width: 10%; text-align:right; <?php echo $tabla_orga_td;?>"><?php echo 'Guardar'; ?></td>
        <td style="width: 10%; text-align:left; <?php echo $tabla_orga_td;?>"><?php echo $this->Form->submit('restaurante/ic_ok.png', array('style' => 'width:inherit;')); ?> </td>
    </tr>
</table>

<?php echo $this->Form->end(); ?>

<!--- FIN MARCO DE LA PANTALLA ------>
</td><td style="width: 20%; border: none;"></tr></table>

<?php
$this->Js->get('#ProductoRubroId')->event('change', 
    $this->Js->request(array(
    	'controller'=>'subrubros',
	'action'=>'getporrubro'
        ), array(
	'update'=>'#ProductoSubrubroId',
	'async' => true,
	'method' => 'post',
	'dataExpression'=>true,
	'data'=> $this->Js->serializeForm(array(
            'isForm' => true,
            'inline' => true
	))
    ))
);
?>
